using ASP;
using HoWave.Common;
using HoWave.Data;
using HoWave.Data.Bll;
using HoWave.Web.Admin;
using System;
using System.Data;
using System.Web.Profile;
using System.Web.SessionState;
using System.Web.UI.WebControls;
public class Admin_MBF_UserGiftCardFestivalSet : Admin, IRequiresSessionState
{
	protected TextBox txtKeywords;
	protected Button Button_Search;
	protected Repeater Repeater_Festival;
	protected DefaultProfile Profile
	{
		get
		{
			return (DefaultProfile)this.Context.Profile;
		}
	}
	protected global_asax ApplicationInstance
	{
		get
		{
			return (global_asax)this.Context.ApplicationInstance;
		}
	}
	protected void Page_Load(object sender, EventArgs e)
	{
		if (!base.IsPostBack)
		{
			try
			{
				if (!base.admin.CheckAdminPower(39))
				{
					base.WriteLog("Modidy", Language.GetAdminMsg("Log/Access", "0"), "MBF_UserGiftCardFestivalSet");
					base.WriteRightErrMsg();
				}
				this.BindData();
			}
			catch (Exception ex)
			{
				MessageBox.Show(this, "数据加载失败！\n" + ex.Message);
			}
		}
	}
	protected void Button_Search_Click(object sender, EventArgs e)
	{
		string str = this.txtKeywords.Text.Trim();
		base.Response.Redirect("MBF_UserGiftCardFestivalSet.aspx?MenuID=5&MenuName=卡类管理&FileName=礼品卡节日管理&keywords=" + str);
	}
	protected void BindData()
	{
		string text = Fetch.Get("keywords");
		string text2 = "";
		if (text != "")
		{
			this.txtKeywords.Text = text;
			text2 = text2 + " FestivalName like '%" + text + "%'";
		}
		DataTable dataSource = Blls.bllFestival.GetListRowid(2147483647, text2, "rowid asc", new string[0]).Tables[0];
		this.Repeater_Festival.DataSource = dataSource;
		this.Repeater_Festival.DataBind();
	}
	protected string GetDelLink(object obj)
	{
		return string.Format("javascript:Deleteid(\"{0}\")", obj);
	}
	protected string GetFestType(object obj)
	{
		string a = obj.IsNull(new object[0]);
		string result;
		if (a == "2")
		{
			result = "其他节日";
		}
		else
		{
			result = "传统节日";
		}
		return result;
	}
	protected string GetDate(object BeginDate, object EndDate, object type)
	{
		string result;
		try
		{
			if (type.IsNull(new object[0]) == "1")
			{
				result = string.Format("{0}~{1}", Convert.ToDateTime(BeginDate).ToString("MM-dd"), Convert.ToDateTime(EndDate).ToString("MM-dd"));
			}
			else
			{
				result = "";
			}
		}
		catch
		{
			result = "";
		}
		return result;
	}
}
